import 'package:flutter/material.dart';
import 'CustomSwitch.dart';

/*
 * @class YesNoSwitch
 * @author: ZhongWb
 * @date: 2020/1/3 15:21
 * @description 是否开关
 **/
class YesNoSwitch extends StatelessWidget {
  double width;
  bool value;
  GestureTapCallback onTap;
  YesNoSwitch({this.width:75,this.value:true,this.onTap});
  @override
  Widget build(BuildContext context) {
    return  Container(
      alignment: Alignment.center,
      width: width,
      height: 25,
      child:  Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: <Widget>[
          Text("否",style: TextStyle(fontSize: 16,color: value == false?Color(0xff4A9DF2):Color(0xff666666)),),
          SizedBox(
            width: 5,
          ),
          CustomSwitch(
            onTap:onTap,
            value: value,
            bgColor: value?Colors.green:Colors.white,
          ),
          SizedBox(
            width: 5,
          ),
          Text("是",style: TextStyle(fontSize: 16,color: value?Color(0xff4A9DF2):Color(0xff666666)),),
        ],
      ),
    );
  }
}
